package com.dabai.iot.mqtt.model;

import cn.hutool.core.util.IdUtil;
import com.dabai.iot.common.model.DeviceInfo;
import io.vertx.mqtt.MqttEndpoint;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

/**
 * MQTT协议设备连接会话
 *
 * @author kev1n
 */
@Slf4j
public class DeviceConnectionSession {

    /**
     * 会话Id
     */
    @Getter
    private final String sessionId;

    @Getter
    private final DeviceInfo deviceInfo;

    @Getter
    private final MqttEndpoint mqttEndpoint;

    public DeviceConnectionSession(DeviceInfo deviceInfo, MqttEndpoint mqttEndpoint) {
        this.deviceInfo = deviceInfo;
        this.mqttEndpoint = mqttEndpoint;

        sessionId = IdUtil.randomUUID();
    }

}
